package com.xudm.imp.service.impl;

import com.deepoove.poi.XWPFTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
public class DocumentGenerateService {
    public void generateDocument() throws IOException {
        Map<String, Object> dataMap = new HashMap<String, Object>();
        dataMap.put("name", "Deepoove");
        XWPFTemplate template = XWPFTemplate.compile("template.docx").render(dataMap);
        template.writeAndClose(new FileOutputStream("output.docx"));
        log.info("Document generated successfully");
    }
}
